package com.design03_behavioral.pattern15_strategy.example03;

import com.design03_behavioral.pattern15_strategy.example02.Receipt;

/**
 * @ClassName ReceiptStrategyContext
 * @Description TODO
 * @Author zhangjunhao
 * @DATE 2023/9/7 1:16
 */
public class ReceiptStrategyContext {


    private ReceiptHandleStrategy receiptHandleStrategy;

    public void setReceiptHandleStrategy(ReceiptHandleStrategy receiptHandleStrategy) {
        this.receiptHandleStrategy = receiptHandleStrategy;
    }


    //调用策略类中的方法
    public void handleReceipt(Receipt receipt){
        if(receipt != null){
            receiptHandleStrategy.handleReceipt(receipt);
        }
    }

}
